package org.example.projecttwo.entity.user;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户基础信息表
 * </p>
 *
 * @author nn
 * @since 2025-11-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user")
@Schema(name="User对象", description="用户基础信息表")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "主键ID（雪花算法）")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "用户编号（对外展示）")
    @TableField("user_no")
    private String userNo;

    @Schema(description = "用户名（登录账号）")
    @TableField("username")
    private String username;

    @Schema(description = "密码（加密存储）")
    @TableField("password")
    private String password;

    @Schema(description = "昵称")
    @TableField("nickname")
    private String nickname;

    @Schema(description = "头像URL")
    @TableField("avatar")
    private String avatar;

    @Schema(description = "手机号")
    @TableField("phone")
    private String phone;

    @Schema(description = "邮箱")
    @TableField("email")
    private String email;

    @Schema(description = "学院ID")
    @TableField("college_id")
    private Long collegeId;

    @Schema(description = "学院名称")
    @TableField("college_name")
    private String collegeName;

    @Schema(description = "账号状态")
    @TableField("status")
    private Integer status;

    @Schema(description = "角色编码")
    @TableField("role_code")
    private String roleCode;

    @Schema(description = "认证类型")
    @TableField("auth_type")
    private Integer authType;

    @Schema(description = "积分")
    @TableField("points")
    private Integer points;

    @Schema(description = "注册时间")
    @TableField(value = "register_time", fill = FieldFill.INSERT)
    private LocalDateTime registerTime;

    @Schema(description = "最后登录时间")
    @TableField("last_login_time")
    private LocalDateTime lastLoginTime;

    @Schema(description = "个性签名")
    @TableField("signature")
    private String signature;

    @Schema(description = "性别")
    @TableField("gender")
    private Integer gender;

    @Schema(description = "出生日期")
    @TableField("birthday")
    private LocalDate birthday;

    @Schema(description = "专业班级")
    @TableField("major_class")
    private String majorClass;

    @Schema(description = "学号")
    @TableField("student_no")
    private String studentNo;

    @Schema(description = "个性标签JSON")
    @TableField("tags_json")
    private String tagsJson;

    @Schema(description = "最后修改昵称时间")
    @TableField("last_nickname_update_time")
    private LocalDateTime lastNicknameUpdateTime;

    @Schema(description = "最后更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "登录失败次数")
    @TableField("login_fail_count")
    private Integer loginFailCount;

    @Schema(description = "账号锁定结束时间")
    @TableField("lock_time")
    private LocalDateTime lockTime;

    @Schema(description = "最后修改密码时间")
    @TableField("password_update_time")
    private LocalDateTime passwordUpdateTime;


}